
function f1 () {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      resolve('f1')
      console.log('f1')
    }, 3000)
  })
}

function f2 () {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      resolve('f2')
      console.log('f2')
    }, 5000)
  })
}

async function asyncF1 () {
  console.log('before f1')
  const ret = await f1()
  console.log('f1的结果是', ret)
  console.log('f1 done!')
}

async function asyncF2 () {
  console.log('before f2')
  const ret = await f2()
  console.log('f2的结果是', ret)
  console.log('f2 done!')
}

// asyncF1()
// asyncF2()
async function f () {
  await asyncF1()
  await asyncF2()
}
f()
